@import 'prefixer';

@axis-color: #000;
@chart-padding: 10px;
@legend-rect-width: 10px;
@hidden-padding: 1px;

.user-select() {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.tui-chart {
  position: relative;
  font-family: Arial;
  .user-select();
  &, * {
    .border-box();
  }
  svg {
      line, path, rect {
          shape-rendering: crispEdges;
      }
      .auto-shape-rendering {
          shape-rendering: auto;
      }
  }
  .tui-chart-icon {
    background-color: '#f4f4f4';
    &:hover {
      background-color: '#eeeeee';
    }
    &:active {
      background-color: '#e5e5e5';
    }
  }
  .tui-chart-title {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 10px 0;
    z-index: 350;
  }

  .tui-chart-axis-area {
    z-index: 300;
    position: absolute;
    * {
      .user-select();
    }
    .tui-chart-title-area {
      position: absolute;
    }

    .tui-chart-tick-area, .tui-chart-label-area {
      position: absolute;
      top: 0;
      width: 100%;
      height: 100%;
    }
    .tui-chart-tick-area {
      .tui-chart-tick {
        position: absolute;
        background-color: @axis-color;
      }
    }

    .tui-chart-label-area {
      .tui-chart-label {
        position: absolute;
        > span {
          line-height: 1.2;
        }
      }
    }

    &.vertical {
      top: @chart-padding;

      .tui-chart-title-area {
        text-align: center;
        white-space: nowrap;
        top: 0;
        &.rotation {
          .transform-origin(top left);
          .rotate(-90deg);
          filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
        }
      }

      .tui-chart-tick-area {
        right: 0;
        .tui-chart-tick {
          right: 1px;
          width: 5px;
          height: 1px;
        }

        .tui-chart-tick-line {
          left: auto;
          right: 0;
          width: 1px;
          background-color: @axis-color;
          position: absolute;
        }
      }

      .tui-chart-label-area {
        right: 10px;
        .tui-chart-label {
          left: 0;
          width: 100%;
          text-align: right;
          white-space: nowrap;
        }
      }

      &.right {
        .tui-chart-title-area {
          text-align: center;
          white-space: nowrap;
          top: 0;
          &.rotation {
            .transform-origin(top left);
            .rotate(90deg);
            filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
          }
        }

        .tui-chart-tick-area, .tui-chart-label-area {
          left: 0;
        }

        .tui-chart-label-area {
          .tui-chart-label {
            text-align: left;
            padding-right: 0;
            padding-left: 10px;
          }
        }
      }

      &.center {
        .tui-chart-title-area {
          width: 100% !important;
          .rotate(0deg);
          filter: none;
          top: auto;
        }

        .tui-chart-label-area {
          left: 0;
          width: 100% !important;
          .tui-chart-label {
            text-align: center;
          }
        }
      }

      &.right .tui-chart-tick-area, &.center .tui-chart-tick-area.opposite-side{
        border-right: none;
        .tui-chart-tick {
          left: 1px;
        }

        .tui-chart-tick-line {
          right: auto;
          left: 0;
        }
      }
    }

    &.horizontal {
      right: @chart-padding;

      .tui-chart-title-area {
        bottom: 0;
        width: 100%;
        text-align: center;
      }

      &.division {
        .tui-chart-title-area {
          left: 0;
          width: auto;
        }

        .tui-chart-title-area.right {
          left: auto;
          right: 0;
        }
      }

      .tui-chart-tick-area, .tui-chart-label-area {
        left: 0;
      }

      .tui-chart-tick-area {
        .tui-chart-tick-line {
          top: 0;
          height: 1px;
          background-color: @axis-color;
          position: absolute;
        }
        .tui-chart-ticks {
          width: 100%;
          position: absolute;
          left: 0;
          top: 0;
        }
        .tui-chart-tick {
          top: 0;
          width: 1px;
          height: 6px;
        }
      }

      .tui-chart-label-area {
        .tui-chart-label {
          top: 10px;
          text-align: center;
          word-wrap: break-word;
          word-break: keep-all;
          &.tui-chart-xaxis-rotation {
            text-align: right;
            span {
              position: absolute;
              right: 0;
              top: 0;
            }
            white-space: nowrap;
          }

          &.tui-chart-xaxis-rotation25 {
            .rotate(-25deg);
            span {
              -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(SizingMethod='auto expand', M11=0.9063077870366499, M12=0.42261826174069944, M21=-0.42261826174069944, M22=0.9063077870366499)";
            }
          }
          &.tui-chart-xaxis-rotation45 {
            .rotate(-45deg);
            span {
              -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(SizingMethod='auto expand', M11=0.7071067811865476, M12=0.7071067811865475, M21=-0.7071067811865475, M22=0.7071067811865476)";
            }
          }
          &.tui-chart-xaxis-rotation65 {
            .rotate(-65deg);
            span {
              -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(SizingMethod='auto expand', M11=0.42261826174069944, M12=0.9063077870366499, M21=-0.9063077870366499, M22=0.42261826174069944)";
            }
          }
          &.tui-chart-xaxis-rotation85 {
            .rotate(-85deg);
            span {
              -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(SizingMethod='auto expand', M11=0.08715574274765814, M12=0.9961946980917455, M21=-0.9961946980917455, M22=0.08715574274765814)";
            }
          }
        }
      }
    }
  }

  .tui-chart-plot-area {
    position: absolute;
    right: @chart-padding;
    top: @chart-padding;
    z-index: -100;

    .tui-chart-plot-optional-lines-area {
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      position: absolute;
    }

    .tui-chart-plot-lines-area {
      width: 100%;
      height: 100%;
      position:relative;
    }
    .tui-chart-plot-line {
      background-color: #ccc;
      position: absolute;
      &.vertical {
        top: 0px;
        width: 1px;
      }

      &.horizontal {
        left: 0px;
        height: 1px;
      }
    }
  }

  .tui-chart-series-area {
    z-index: 200;
    position: absolute;
    &:first-child {
      overflow: visible;
    }
    .user-select();

    .tui-chart-series-block-area {
      position: absolute;
      left: 10px;
      top: 10px;
      .tui-chart-series-block {
        position: absolute;
      }
    }

    .tui-chart-series-label-area {
      position: absolute;
      overflow: visible;
      left: 0px;
      top: 0px;
      display: none;
      .opacity(0);
      .tui-chart-series-label {
        position: absolute;
        cursor: default;
        text-align: center;
        white-space: nowrap;
        .text-shadow(#fff 0px 0px 3px);
      }
      &.show {
        display: block;
      }

      &.opacity {
        .opacity(1);
      }
    }

    .tui-chart-series-graph-area {
      position: absolute;
      left: 0;
      top: 0;
    }
  }

  .tui-chart-zoom-area {
    z-index: 1500;
    position: absolute;
    .border-radius(1px);
    > .tui-chart-zoom-btn {
      width: 24px;
      height: 24px;
      display: block;
      background-color: #f4f4f4;
      border-radius: 1px;
      cursor: pointer;
      margin-top: 5px;
      &.zoom-in {
        background-image: url();
        &:hover {
          background-image: url();
        }
        &:active {
          background-image: url();
        }
      }

      &.zoom-out {
        background-image: url();
        &:hover {
          background-image: url();
        }
        &:active {
          background-image: url();
        }
      }
      
    }
  }

  .tui-chart-series-custom-event-area {
    z-index: 1000;
    position: absolute;
    left: 0;
    top: 0;

    &.hide {
      display: none;
    }

    &.drag {
      cursor: move;
    }

    .tui-chart-drag-selection {
      top: 10px;
      height: 100%;
      background-color: gray;
      .opacity(0.3);
      position: absolute;
      display: none;
      &.show {
        display: block;
      }
    }

    .tui-chart-reset-zoom-btn {
      position:absolute;
      left: 20px;
      top: 20px;
      background-image: url();
      border-radius: 1px;
      font-size: 11px;
      width: 24px;
      height: 24px;
      cursor: pointer;
      .user-select();
      &:hover {
        background-image: url();
      }
      &:active {
        background-image: url();
      }
    }
  }

  .tui-chart-legend-rect {
    margin-top: 2px;
    width: @legend-rect-width;
    height: @legend-rect-width;
    &.line {
      padding: 3px 0;
    }
  }
  .tui-chart-chartExportMenu-area {
    position: absolute;
    font-family: Verdana;
    margin: 0;
    z-index: 1001;
    .tui-chart-chartExportMenu-button {
      position: absolute;
      width: 24px;
      height: 24px;
      right :0;
      background-image: url();
      background-color: #f4f4f4;
      border: 0px;
      font-size: 12px;
      padding: 3px 5px;
      margin: 0;
      cursor: pointer;
      &:hover {
        background-image: url();
      }
      &:active {
        background-image: url();
      }
    }
    &.menu-opened {
        .tui-chart-chartExportMenu-button{
            background-image: url('');
            &:hover {
              background-image: url();
            }
            &:active {
              background-image: url();
            }
        }
    }
    ul {
      display: none;
      position: absolute;
      top: 28px;
      right: 0;
      width: 150px;
      background: #fff;
      border: 1px solid #bab9ba;
      font-size: 11px;
      padding: 0;
      margin: 0;
        > li {
          margin: 0;
          border-collapse: collapse;
          text-align: center;
          list-style-type: none;
          &.tui-chart-chartExportMenu-head {
              padding: 10px;
              text-align: left;
              background-color: #f3f3f3;
              margin: 1px 1px 0 0;
          }
          &.tui-chart-chartExportMenu-body {
              display: inline-block;
              width: 100%;
              padding: 7px 0;
              > li {
                  padding: 12px 3px;
                  line-height: 1;
                  cursor: pointer;
                  width: 50%;
                  float: left;
                  &:hover {
                      font-weight: bold;
                  }
              }
          }
        }
    }
  }
  .tui-chart-legend-area {
    z-index: 400;
    position: absolute;
    padding: 10px;
    .user-select();
    .tui-chart-legend {
      clear: both;
      > div {
        float: left;
      }

      .tui-chart-legend-checkbox-area {
        width: 20px;
        height: 20px;
        position: relative;
        input {
          left: 2px;
          top: 2px;
          *left: -2px;
          *top: -2px;
          position: absolute;
          padding: 0;
          margin: 0;
        }
        .border-box();
      }

      .tui-chart-legend-label {
        padding: 2px 0 2px 4px;
        cursor: pointer;
        .content-box();
        line-height: 1;
      }

      &.unselected {
        .tui-chart-legend-rect {
          .opacity(0.3);
        }

        .tui-chart-legend-label {
          .opacity(0.3);
        }
      }
    }

    .tui-chart-legend-tick-area {
      position:absolute;
      left: 10px;
      top: 10px;
      .tui-chart-map-legend-tick {
        width: 15px;
        height: 1px;
        background-color: #ccc;
        position: absolute;
        left: 0px;
      }

      .tui-chart-map-legend-tick-label {
        position: absolute;
        left: 30px;
        text-align: left;
      }

      &.horizontal {
        .tui-chart-map-legend-tick {
          top: 0px;
          width: 1px;
          height: 15px;
        }

        .tui-chart-map-legend-tick-label {
          top: 30px;
        }
      }
    }

    .tui-chart-map-legend-wedge {
      position: absolute;
      width: 19px;
      height: 4px;
      border-left: 2px solid #777;
      border-right: 2px solid #777;
      left: 8px;
      top: 30px;
      display: none;
      &.show {
        display: block;
      }
    }

    &.horizontal {
      padding-left: 0;
      padding-right: 0;
      .tui-chart-legend {
        clear: none;
        float: left;
        white-space: nowrap;
      }
    }
  }

  .tui-chart-circle-legend-area {
    position: absolute;
    z-index: 400;
    .tui-chart-circle-legend-label-area {
      position: absolute;
      left: 0;
      top: 0;
      .tui-chart-circle-legend-label {
        position: absolute;
        font-size: 9px;
        white-space: nowrap;
        .text-shadow(#fff 0px 0px 3px);
      }
    }
  }

  .tui-chart-tooltip-area {
    position: absolute;
    z-index: 1010;
    * {
      .user-select();
    }
    .tui-chart-tooltip {
      z-index: 100;
      position: absolute;
      display: none;
      user-select: none;
      font-size: 12px;
      font-weight: normal;
      color: #ffffff;
      &.show {
        display: block;
      }
      .tui-chart-default-tooltip {
        .border-radius(3px);
        background-color: #5f5f5f;
        background-color: rgba(85, 85, 85, 0.95);
        > * {
          text-align: left;
          white-space: nowrap;
        }
        > .tui-chart-tooltip-head {
            padding: 8px 15px;
            border-bottom: 1px solid #565656;
            font-size: 13px;
            font-weight: bold;
            border-bottom: 1px solid rgb(0, 0, 0);
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        }
        > table {
            width: 100%;
            border-spacing: 0;
            border-collapse: separate;
            tr {
                padding-bottom: 5px;
            }
        }
        > .tui-chart-tooltip-body {
            border-bottom: 1px solid rgb(0, 0, 0);
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
            padding: 11px 15px;
            span {
                display: inline-block;
                height: 10px;
                &.tui-chart-legend-rect {
                    width: 10px;
                    margin-right: 8px;
                    vertical-align: text-top;
                    &.line {
                        padding: 0;
                    }
                }
            }
            .tui-chart-tooltip-value {
                padding-left: 44px;
                text-align: right;
            }
        }

        &.tui-chart-group-tooltip {
          > * {
            text-align: left;
            position: relative;
            padding-left: @legend-rect-width + 8;
            padding-top: 4px;
            padding-bottom: 4px;
          }

          > table {
              border-spacing: 0;
              border-collapse: separate;
              tr {
                  padding-bottom: 5px;
                  &:last-child {
                    padding-bottom: 0;
                  }
              }
          }
          > .tui-chart-tooltip-body {
              padding: 11px 15px;
              font-size: 12px;
              font-weight: lighter;
              > span {
                  display: inline-block;
              }
              .tui-chart-tooltip-value {
                  padding-left: 44px;
                  text-align: right;
              }
          }
          .tui-chart-legend-rect {
            position: relative;
            left: 0px;
            top: -2px;
            margin-right: 5px;
          }
          > .tui-chart-tooltip-head {
            padding: 8px 15px;
            text-align: left;
          }

          > .tui-chart-tooltip-type {
            padding-left: 7px;
          }
        }

        .hide {
          display: none;
        }
      }
    }

    .tui-chart-group-tooltip-sector {
      z-index: 50;
      position: absolute;
      background-color: #aaa;
      .opacity(0.3);
      display: none;
      &.show {
        display: block;
      }
    }
  }

  &.tui-map-chart {
    .tui-chart-series-area {
      overflow: hidden;
    }

    .tui-chart-tooltip-area {
      .tui-chart-default-tooltip {
        > :first-child {
          font-weight: normal;
        }
      }
    }
  }

  &.tui-treemap-chart {
    .tui-chart-reset-zoom-btn {
      background-image: url();
      &:hover {
        background-image: url();
      }
      &:active {
        background-image: url();
      }
    }
  }
}

.tui-chart-size-check-element {
  clear: both;
  position: absolute;
  word-wrap: break-word;
  word-break: keep-all;
  top: 100000px;
  left: 100000px;
  width: 1000px;
  height: 100px;
  padding: 0;
  line-height: 1;
  > span {
    display: inline-block;
    box-sizing: border-box;
    text-align: center;
    padding: 0;
  }
}

:root .tui-chart .tui-chart-axis-area {
  &.vertical .tui-chart-title-area {
    filter: none \0;
  }
  &.horizontal {
    .tui-chart-label {
      &.tui-chart-xaxis-rotation25, &.tui-chart-xaxis-rotation45, &.tui-chart-xaxis-rotation65, &.tui-chart-xaxis-rotation85 {
        span {
          filter: none \0;
        }
      }
    }
  }
}

.box-shadow {
  filter: shadow(0 4px 4px);
}
